<?php

namespace addons\pms;

use app\common\library\Menu;
use think\Addons;

/**
 * 插件
 */
class Pms extends Addons
{

    /**
     * 插件安装方法
     * @return bool
     */
    public function install()
    {
        $menu = [
            [
                'name'    => 'pms',
                'title'   => '酒店管理',
                'icon'    => 'fa fa-building',
                'weigh'   => 99,
                'sublist' => [
                    [
                        'name'    => 'pms/pmsroomstatus',
                        'title'   => '房态管理',
                        'icon'    => 'fa fa-calendar',
                        'weigh'   => 99,
                        'sublist' => [
                            ["name"  => "pms/pmsroomstatus/index","title" => "查看"],
                            ["name"  => "pms/pmsroomstatus/reserve","title" => "预定房间"],
                            ["name"  => "pms/pmsroomstatus/order_detail","title" => "订单详情"],
                            ["name"  => "pms/pmsroomstatus/reserve_detail","title" => "预定详情"],
                            ["name"  => "pms/pmsroomstatus/checkin","title" => "散客入住"],
                            ["name"  => "pms/pmsroomstatus/calendar","title" => "房态日历"],
                            ["name"  => "pms/pmsroomstatus/pay","title" => "收款"],
                            ["name"  => "pms/pmsroomstatus/checkout","title" => "退房"],
                            ["name"  => "pms/pmsroomstatus/ajax_set_room","title" => "Ajax设置房态"],
                            ["name"  => "pms/pmsroomstatus/ajax_get_room_price_list","title" => "Ajax获取房价列表"],
                            ["name"  => "pms/pmsroomstatus/ajax_get_room_status_calendar","title" => "日历Ajax：获取房态日历"],
                            ["name"  => "pms/pmsroomstatus/ajax_get_room_status_info","title" => "日历Ajax：获取房态详情"],
                            ["name"  => "pms/pmsroomstatus/ajax_get_order_payment","title" => "Ajax获取支付列表"],
                            ["name"  => "pms/pmsroomstatus/ajax_cancel_payment","title" => "Ajax提交支付作废"],
                            ["name"  => "pms/pmsroomstatus/ajax_checkout","title" => "Ajax提交退房"],
                            ["name"  => "pms/pmsroomstatus/ajax_get_project","title" => "Ajax退房操作：获取项目列表"],
                            ["name"  => "pms/pmsroomstatus/ajax_update_order_info","title" => "Ajax修改订单信息"],
                            ["name"  => "pms/pmsroomstatus/ajax_add_order_items","title" => "Ajax增加消费记录"],
                            ["name"  => "pms/pmsroomstatus/ajax_update_reserve_info","title" => "Ajax修改预定信息"],
                            ["name"  => "pms/pmsroomstatus/ajax_change_into_order","title" => "Ajax预定转入订单操作"],
                        ]
                    ],
                    [
                        'name'    => 'pms/pmsorderinfo',
                        'title'   => '酒店订单信息',
                        'icon'    => 'fa fa-circle-o',
                        'weigh'   => 98,
                        'sublist' => [
                            ["name"  => "pms/pmsorderinfo/index","title" => "查看"],
                            ["name"  => "pms/pmsorderinfo/detail","title" => "订单详情"],
                        ]
                    ],
                    [
                        'name'    => 'pms/pmsreserveinfo',
                        'title'   => '酒店预定订单信息',
                        'icon'    => 'fa fa-circle-o',
                        'weigh'   => 97,
                        'sublist' => [
                            ["name"  => "pms/pmsreserveinfo/index","title" => "查看"],
                            ["name"  => "pms/pmsreserveinfo/detail","title" => "预定详情"],
                        ]
                    ],
                    [
                        'name'    => 'pms/pmsorderpayment',
                        'title'   => '收款管理',
                        'icon'    => 'fa fa-circle-o',
                        'weigh'   => 96,
                        'sublist' => [
                            ["name"  => "pms/pmsorderpayment/index","title" => "查看"],
                            ["name"  => "pms/pmsorderpayment/detail","title" => "收款详情"],
                        ]
                    ],
                    [
                        'name'    => 'pms/pmsuser',
                        'title'   => '酒店会员信息',
                        'icon'    => 'fa fa-circle-o',
                        'weigh'   => 95,
                        'sublist' => [
                            ["name"  => "pms/pmsuser/index","title" => "查看"],
                            ["name"  => "pms/pmsuser/edit","title" => "编辑"],
                            ["name"  => "pms/pmsuser/get_user_order_list","title" => "获取用户的订单列表"],
                            
                        ]
                    ],
                    [
                        'name'    => 'pms/pmsreport',
                        'title'   => '酒店运营报表',
                        'icon'    => 'fa fa-dashboard fa-fw',
                        'weigh'   => 94,
                        'sublist' => [
                            ["name"  => "pms/pmsreport/index","title" => "查看"],
                        ]
                    ],

                ]
            ],
            [
                'name'    => 'pmsbasic',
                'title'   => '酒店基础信息',
                'icon'    => 'fa fa-cubes',
                'weigh'   => 98,
                'sublist' => [
                    [
                        'name'    => 'pms/pmsmaillist',
                        'title'   => '酒店通讯录',
                        'icon'    => 'fa fa-address-book',
                        'weigh'   => 99,
                        'sublist' => [
                            ["name"  => "pms/pmsmaillist/index","title" => "查看"],
                            ["name"  => "pms/pmsmaillist/add","title" => "添加"],
                            ["name"  => "pms/pmsmaillist/edit","title" => "编辑"],
                        ]
                    ],
                    [
                        'name'    => 'pms/pmsroomitems',
                        'title'   => '酒店房间物品信息',
                        'icon'    => 'fa fa-circle-o',
                        'weigh'   => 98,
                        'sublist' => [
                            ["name"  => "pms/pmsroomitems/index","title" => "查看"],
                            ["name"  => "pms/pmsroomitems/add","title" => "添加"],
                            ["name"  => "pms/pmsroomitems/edit","title" => "编辑"],
                            ["name"  => "pms/pmsroomitems/selectpage","title" => "Selectpage搜索"],
                        ]
                    ],
                    [
                        'name'    => 'pms/pmsservicesitems',
                        'title'   => '酒店服务项目',
                        'icon'    => 'fa fa-circle-o',
                        'weigh'   => 96,
                        'sublist' => [
                            ["name"  => "pms/pmsservicesitems/index","title" => "查看"],
                            ["name"  => "pms/pmsservicesitems/add","title" => "添加"],
                            ["name"  => "pms/pmsservicesitems/edit","title" => "编辑"],
                            ["name"  => "pms/pmsservicesitems/selectpage","title" => "Selectpage搜索"],
                        ]
                    ],
                    [
                        'name'    => 'pms/pmsworker',
                        'title'   => '酒店工作人员信息',
                        'icon'    => 'fa fa-circle-o',
                        'weigh'   => 95,
                        'sublist' => [
                            ["name"  => "pms/pmsworker/index","title" => "查看"],
                            ["name"  => "pms/pmsworker/add","title" => "添加"],
                            ["name"  => "pms/pmsworker/edit","title" => "编辑"],
                        ]
                    ],
                    [
                        'name'    => 'pms/pmsroomtype',
                        'title'   => '酒店房间类型',
                        'icon'    => 'fa fa-circle-o',
                        'weigh'   => 94,
                        'sublist' => [
                            ["name"  => "pms/pmsroomtype/index","title" => "查看"],
                            ["name"  => "pms/pmsroomtype/add","title" => "添加"],
                            ["name"  => "pms/pmsroomtype/edit","title" => "编辑"],
                            ["name"  => "pms/pmsroomtype/selectpage","title" => "Selectpage搜索"],
                        ]
                    ],
                    [
                        'name'    => 'pms/pmsroominfo',
                        'title'   => '酒店房间信息',
                        'icon'    => 'fa fa-circle-o',
                        'weigh'   => 93,
                        'sublist' => [
                            ["name"  => "pms/pmsroominfo/index","title" => "查看"],
                            ["name"  => "pms/pmsroominfo/add","title" => "添加"],
                            ["name"  => "pms/pmsroominfo/edit","title" => "编辑"],
                            ["name"  => "pms/pmsroominfo/selectpage","title" => "Selectpage搜索"],
                        ]
                    ],
                    [
                        'name'    => 'pms/pmsspecialprice',
                        'title'   => '特殊日期价格管理',
                        'icon'    => 'fa fa-circle-o',
                        'weigh'   => 92,
                        'sublist' => [
                            ["name"  => "pms/pmsspecialprice/index","title" => "查看"],
                            ["name"  => "pms/pmsspecialprice/add","title" => "添加"],
                            ["name"  => "pms/pmsspecialprice/edit","title" => "编辑"],
                        ]
                    ],
                    [
                        'name'    => 'pms/pmseventlogs',
                        'title'   => '事件日志',
                        'icon'    => 'fa fa-circle-o',
                        'weigh'   => 91,
                        'sublist' => [
                            ["name"  => "pms/pmseventlogs/index","title" => "查看"],
                            ["name"  => "pms/pmseventlogs/detail","title" => "查看详情"],
                        ]
                    ],
                    

                ]
            ],

        ];

        Menu::create($menu);
        return true;
    }

    /**
     * 插件卸载方法
     * @return bool
     */
    public function uninstall()
    {
        Menu::delete("pmsbasic");
        Menu::delete("pms");
        return true;
    }

    /**
     * 插件启用方法
     * @return bool
     */
    public function enable()
    {
        Menu::enable("pmsbasic");
        Menu::enable("pms");
        return true;
    }

    /**
     * 插件禁用方法
     * @return bool
     */
    public function disable()
    {
        Menu::disable("pmsbasic");
        Menu::disable("pms");
        return true;
    }


}
